package com.taoye.thread;

public class Demo18 {
	public static void main(String[] args) throws InterruptedException {
		Demo18Thread t = new Demo18Thread();
		t.setName("A");
		t.setDaemon(true);
		t.start();
//		Demo18Thread t2 = new Demo18Thread();
//		t2.setName("B");
//		t2.start();
		Thread.sleep(3000);
		System.out.println("主线程结束了");
	}
}

class Demo18Thread extends Thread {
	@Override
	public void run() {
		try {
			while (true) {
				System.out.println(this.getName() + "线程打印当前时间：" + System.currentTimeMillis());
				Thread.sleep(1000);
			}
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}